home *** CD-ROM | disk | FTP | other *** search
/ Aminet 19 / Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso / Aminet / comm / tcp / ModServer11.lha / ModServer.amirx < prev    next >
Text File  |  1997-03-14  |  3KB  |  141 lines

  1. /* ModServer by Shades / fake a.k.a. Erik Lindberg 96-11-14 
  2. -Fixed lha of () names 96-11-26
  3. -Fixed packing of already packed files 97-03-13
  4. -Shortened it down 97-03-13
  5. */
  6.  
  7. authorpath='AmiTCP:Clients/AmIRC/rexx/'
  8. temppath='ram:'
  9.  
  10. /* Don't change below unless you know what you're doing */
  11.  
  12. options results
  13. parse arg last
  14.  
  15. address AMIRC.1
  16.  
  17. last=compress(last,D2C(1))
  18. parseline last
  19. text=line.rest
  20. nick=line.prefix
  21. first=index(nick,'!')
  22. nick=substr(nick,1,first-1)
  23.  
  24. address AMIRC.1 'getmynick'
  25. ownnick=result
  26.  
  27. if upper(text) == ":GETMOD" | upper(text) == ":MODGET" then do
  28.     if show('P','HIPPOPLAYER') then do
  29.         address HIPPOPLAYER
  30.         get FNAM
  31.         filename=result
  32.     end
  33.     
  34.     if show('P','DELITRACKER') then do
  35.         address DELITRACKER
  36.         status m fil
  37.         filename=result
  38.         status m dir
  39.         dirname=result
  40.         filename=insert(filename,dirname,length(dirname))
  41.     end
  42.  
  43.     archivename=substr(filename,max(lastpos(':', filename),lastpos('/', filename)) +1)    
  44.     archivename=delstr(archivename,lastpos('.',archivename))
  45.     archivename=compress(archivename,'()')
  46.  
  47.     filename=translate(filename,'??','()')
  48.     if upper(right(filename,4)) ~= ".LHA" then do
  49.         address command 'lha -h a 'temppath||archivename||' '||filename
  50.         address AMIRC.1    'say /dcc send 'nick' 'temppath||archivename'.lha'
  51.     end
  52.     else
  53.         address AMIRC.1    'say /dcc send 'nick' '||filename
  54.     end
  55.  
  56. if upper(text) == ":GETMODUNPACK" | upper(text) == ":MODGETUNPACK" then do
  57.     if show('P','HIPPOPLAYER') then do
  58.         address HIPPOPLAYER
  59.         get FNAM
  60.         filename=result
  61.     end
  62.     
  63.     if show('P','DELITRACKER') then do
  64.         address DELITRACKER
  65.         status m fil
  66.         filename=result
  67.         status m dir
  68.         dirname=result
  69.         filename=insert(filename,dirname,length(dirname))
  70.     end
  71.  
  72.     address AMIRC.1    'say /dcc send 'nick' 'filename    
  73. end
  74. if upper(text) == ":MODINFO" then do
  75.     yes=0
  76.     if show('P','HIPPOPLAYER') then do
  77.             yes=1
  78.         address 'HIPPOPLAYER'
  79.         GET NAME
  80.         modname=result
  81.  
  82.         GET SIZE
  83.         size=result%1024
  84.  
  85.         address AMIRC.1 'say /msg 'nick' 'ownnick' is playing 'd2c(2)modname d2c(2)'size: 'size'K. Do a /CTCP 'ownnick' getmod to fetch it, and use getmodunpack to get it unpacked' 
  86.     end
  87.  
  88.     if show('P','DELITRACKER') then do
  89.         yes=1
  90.         address 'DELITRACKER'
  91.         status m nam
  92.         modname=result
  93.  
  94.         status m dir
  95.         creator=result
  96.         creator=delstr(creator,length(creator))
  97.         creator=substr(creator,max(lastpos(':', creator),lastpos('/', creator)) +1)
  98.  
  99.         creator=seekcreator(creator)
  100.         if creator=='' then
  101.             address AMIRC.1 'say /msg 'nick' 'ownnick' is playing 'd2c(2)modname d2c(2)'. Do a /CTCP 'ownnick' getmod to fetch it, and use getmodunpack to get it unpacked'
  102.         else
  103.             address AMIRC.1 'say /msg 'nick' 'ownnick' is playing 'd2c(2)modname d2c(2)' by: 'creator'. Do a /CTCP 'ownnick' getmod to fetch it, and use getmodunpack to get it unpacked'
  104.     end
  105.     
  106.     if yes == 0 then
  107.         address AMIRC.1 'say /msg 'nick' 'ownnick' is not playing any modules. Try again later.'
  108. end
  109.  
  110. seekcreator:
  111. parse arg creator
  112. if open('Authors',authorpath'Authornames.txt','R') then do
  113.     seek=0
  114.     DO UNTIL seek==1 | EOF('Authors')
  115.         string=READLN('Authors')
  116.         if find(string,creator) then do
  117.             creator=subword(string, 3)
  118.             seek=1
  119.         end
  120.     end
  121. close('Authors')
  122. end
  123.  
  124. if seek==0 then do
  125.     if open('Groups',authorpath'Groupnames.txt','R') then do
  126.         seek=0
  127.         DO UNTIL seek==1 | EOF('Groups')
  128.             string=READLN('Groups')
  129.             if find(string,creator) then do
  130.                 creator=subword(string, 3)
  131.                 creator=INSERT('someone in ',creator,0)
  132.                 seek=1
  133.             end
  134.         end
  135.     close('Groups')
  136.     end
  137. end
  138.  
  139. if seek==0 then creator=''
  140. return creator
  141.